package BanyuanClub.Work.Day0304;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class InPicture {
    public static void main(String[] args) {
        //图片字节输出
       try(FileInputStream fis = new FileInputStream("picture.jpeg")){
           //图片字节输入
           FileOutputStream fos = new FileOutputStream("pictrue1.jpeg");
           //每次输入大小
           byte[] by = new byte[1024];
           //当最后一次输入输出流不足1024字节是，输入输出end字节，避免冗余。
           int end;
           while ((end = fis.read(by)) != -1){
               //将输入的fis输出到fos.
               fos.write(by,0,end);
           }
       } catch (FileNotFoundException e) {
           e.printStackTrace();
       } catch (IOException e) {
           e.printStackTrace();
       }
    }
}
